<template>
  <div id="test4" style="height:100%">
    <el-card style="height:45%">
      <span>查询条件</span>
      <el-form :inline="true" :model="queryData" class="demo-form-inline">
        <el-form-item label="查询时间">
          <el-date-picker
            v-model="value1"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="班级">
          <el-input placeholder="请输入班级" style="width: 160px"></el-input>
        </el-form-item>
        <el-form-item label="监护人姓名">
          <el-input v-model="queryData.guardianName" placeholder="请输入监护人姓名" style="width: 160px"></el-input>
        </el-form-item>
        <el-form-item label="监护人手机">
          <el-input v-model="queryData.phone" placeholder="请输入监护人手机" style="width: 160px"></el-input>
        </el-form-item>
        <el-form-item label="监护人类别">
          <el-input placeholder="请输入监护人类别" style="width: 160px"></el-input>
        </el-form-item>
        <el-form-item label="学生姓名">
          <el-input v-model="queryData.studentName" placeholder="请输入学生姓名" style="width: 160px"></el-input>
        </el-form-item>
        <el-form-item label="监护人卡号">
          <el-input placeholder="请输入监护人卡号" style="width: 160px"></el-input>
        </el-form-item>
        <el-form-item label="设备名称">
          <el-input placeholder="请输入设备名称" style="width: 160px"></el-input>
        </el-form-item>
        <el-form-item label="设备号">
          <el-input placeholder="请输入设备号" style="width: 160px"></el-input>
        </el-form-item>
        <el-form-item label="接送类型">
          <el-input placeholder="请输入接送类型" style="width: 160px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" :model="queryData" class="demo-form-inline">
        <el-button @click="handleQuery" type="primary" style="width: 100px">查询</el-button>
        <el-button type="primary" style="mairgin-left: 120px; width: 100px">导出</el-button>
      </el-form>
      <!--<el-form label-width="100px" style="margin-top: 10px">
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="查询时间">
              <el-date-picker
                v-model="value1"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="班级">
              <el-input placeholder="请输入班级" style="width: 130px"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="监护人姓名">
              <el-input
                v-model="queryData.guardianName"
                placeholder="请输入监护人姓名"
                style="width: 130px"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="监护人手机">
              <el-input v-model="queryData.phone" placeholder="请输入监护人手机" style="width: 130px"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="4">
            <el-form-item label="监护人类别">
              <el-input placeholder="请输入监护人类别" style="width: 130px"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="学生姓名">
              <el-input v-model="queryData.studentName" placeholder="请输入学生姓名" style="width: 130px"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="监护人卡号">
              <el-input placeholder="请输入监护人卡号" style="width: 130px"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="设备名称">
              <el-input placeholder="请输入设备名称" style="width: 130px"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item label="设备号">
              <el-input placeholder="请输入设备号" style="width: 130px"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="4">
            <el-form-item label="接送类型">
              <el-input placeholder="请输入接送类型" style="width: 130px"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="3">
            <el-button @click="handleQuery" type="primary" style="width: 100px">查询</el-button>
          </el-col>
          <el-col :span="2">
            <el-button type="primary" style="width: 100px">导出</el-button>
          </el-col>
        </el-row>
      </el-form>-->
    </el-card>
    <el-card style="margin-top: 20px; height:52%">
      <span>接送记录</span>
      <el-table
        ref="multipleTable"
        v-loading="loading"
        :data="pageInfo.list"
        tooltip-effect="dark"
        max-height="240"
        style="
          width: 100%;
          text-align: center;
          align-items: center;
          justify-content: center;
        "
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="guardianName" align="center" label="监护人姓名" width="120px"></el-table-column>
        <el-table-column prop="photoUrl" align="center" label="抓拍照片" width="150px"></el-table-column>
        <el-table-column prop="phone" align="center" label="手机" width="120px"></el-table-column>
        <el-table-column prop="type" align="center" label="监护人类别" width="120px"></el-table-column>
        <el-table-column prop="studentName" align="center" label="学生姓名" width="120px"></el-table-column>
        <el-table-column prop="clazz" align="center" label="班级" width="120px"></el-table-column>
        <el-table-column prop="device" align="center" label="设备名称" width="120px"></el-table-column>
        <el-table-column prop="deviceId" align="center" label="设备号" width="120px"></el-table-column>
        <el-table-column prop="cardId" align="center" label="监护人卡号" width="120px"></el-table-column>
        <el-table-column prop="date" align="center" label="接送时间" width="200px" column-key="date"></el-table-column>
        <el-table-column align="center" fixed="right" label="操作" width="150px">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="handleCheck(scope.row)">查看</el-button>
            <el-button type="text" size="small" @click="handleDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
        <div></div>
      </el-table>
      <div class="block" style="margin-top:10px">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageInfo.pageNum"
          :page-size="pageInfo.pageSize"
          layout="total, prev, pager, next, jumper"
          :total="pageInfo.total"
        ></el-pagination>
      </div>
    </el-card>

    <el-dialog title="监护人详细信息" :visible.sync="dialogVisible" center width="40%">
      <el-row class="top_img" style="display:flex;justify-content: center;">
        <img class="photo" src="../assets/images/shoyeimg1.jpg" height="200px" center />
      </el-row>
      <el-row style="margin-top:10px">
        <el-col class="stu_info" :span="6" style="border-width: 2px 1px 1px 2px">
          <div class="grid-content bg-purple">监护人姓名</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 2px 1px 1px 1px;">
          <div class="grid-content bg-purple">{{row.guardianName}}</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 2px 1px 1px 1px">
          <div class="grid-content bg-purple">监护人类别</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 2px 2px 1px 1px">
          <div class="grid-content bg-purple">{{row.type}}</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col class="stu_info" :span="6" style="border-width: 1px 1px 1px 2px">
          <div class="grid-content bg-purple" style="border:1px">监护人手机号</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px">
          <div class="grid-content bg-purple">{{row.phone}}</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px">
          <div class="grid-content bg-purple">监护人卡号</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px 2px 1px 1px">
          <div class="grid-content bg-purple">{{row.cardId}}</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col class="stu_info" :span="6" style="border-width: 1px 1px 1px 2px">
          <div class="grid-content bg-purple">学生姓名</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px">
          <div class="grid-content bg-purple">{{row.studentName}}</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px">
          <div class="grid-content bg-purple">学生班级</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px 2px 1px 1px">
          <div class="grid-content bg-purple">{{row.clazz}}</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col class="stu_info" :span="6" style="border-width: 1px 1px 1px 2px">
          <div class="grid-content bg-purple">接送类型</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px">
          <div class="grid-content bg-purple">123</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px">
          <div class="grid-content bg-purple">设备名称</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px 2px 1px 1px">
          <div class="grid-content bg-purple">{{row.device}}</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col class="stu_info" :span="6" style="border-width: 1px 1px 2px 2px">
          <div class="grid-content bg-purple">设备号</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px 1px 2px 1px">
          <div class="grid-content bg-purple">{{row.deviceId}}</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px 1px 2px 1px">
          <div class="grid-content bg-purple">接送时间</div>
        </el-col>
        <el-col class="stu_info" :span="6" style="border-width: 1px 2px 2px 1px;">
          <div class="grid-content bg-purple">{{row.date}}</div>
        </el-col>
      </el-row>
    </el-dialog>
  </div>
</template>
<script>
import { queryPickup } from "@/api/jilu";
export default {
  name: "JingChu",
  //组件创建
  created() {},
  mounted() {
    this.getList()
  },
  data() {
    return {
      //详细信息弹窗可见性
      dialogVisible: false,
      //获取详细信息的行数
      row: "",
      //查询参数
      queryData:{
        stydentName: "",
        guardianName: "",
        phone: "",
        pageSize: "3",
        pageNum: "1",

      },
      // 遮罩层
      loading: false,
      //表格数据
      pageInfo: {}, 
      multipleSelection: [],
      value1: "",
    };
  },
  methods: {
    /** 查询记录列表 */
    getList() {
      this.loading = true;
      queryPickup(this.queryData).then((response) => {
        this.pageInfo = response.data.pageInfo;
        this.loading = false;
      });
    },
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    /**查看详细信息操作 */
    handleCheck(row) {
      this.dialogVisible = true;
      this.row = row;
    },
    /** 搜索按钮操作 */
    handleQuery() {
      //this.queryData.startTime = this.timePicker[0];
      //this.queryData.endTime = this.timePicker[1];
      console.log(this.queryData);
      //this.getList();
      //this.$message.success("查询成功");
    },
    /** 处理分页 */
    handleSizeChange(val) {
      this.queryData.pageSize = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.queryData.pageNum = val;
      this.getList();
    },
    /**删除操作 */
    handleDelete(row) {
      console.log(row);
      this.$message("哈！不能删！");
    },
  },
};
</script>
<style lang="less" scoped>
.stu_info {
  height: 60px;
  //line-height: 60px; //行高居中
  border: solid;
  display: table;
  margin: 0 auto;
}
.grid-content {
  font-size: 17px;
  display: table-cell;
  vertical-align: middle;
  padding: 0 10px 0 10px;
}
</style>
